package com.neusoft.bizcore.web.exception;

/**
 * united exception <br />
 * all business runtime exception should wrapped by UnitedException <br/>
 * and ResponseEntityExceptionHandler will handle this exception and response
 * united information to client.
 *
 * @author sunchf
 * @date 2020年4月1日 上午8:20:25
 */
public class UnitedException extends RuntimeException {

    private static final long serialVersionUID = 519380986200368291L;

    private final String message;

    public UnitedException(final String message) {
        super(message);
        this.message = message;
    }

    public UnitedException(final String message, final Object... params) {
        final String formatMessage = String.format(message, params);
        this.message = formatMessage;

    }

    public UnitedException(final Throwable th) {
        super(th);
        this.message = th.getMessage();
    }

    public UnitedException(final String message, final Throwable th) {
        super(message, th);
        this.message = message;
    }

    @Override
    public String getMessage() {
        return this.message;
    }

}
